﻿#include "SharedData.h"

SelectInfo::SelectInfo()
{
}

SelectInfo::SelectInfo(BinaryReader *reader)
{
    Index = reader->ReadInt32();
    Name = reader->ReadString();
    Level = reader->ReadUInt16();
    Class = static_cast<MirClass>(reader->ReadByte());
    Gender = static_cast<MirGender>(reader->ReadByte());
    LastAccess = DateTime::FromBinary(reader->ReadInt64());
}

void SelectInfo::Save(BinaryWriter *writer)
{
    writer->Write(Index);
    writer->Write(Name);
    writer->Write(Level);
    writer->Write(static_cast<unsigned char>(Class));
    writer->Write(static_cast<unsigned char>(Gender));
    writer->Write(LastAccess.ToBinary());
}

RankCharacterInfo::RankCharacterInfo()
{

}

RankCharacterInfo::RankCharacterInfo(BinaryReader *reader)
{
    PlayerId = reader->ReadInt64();
    Name = reader->ReadString();
    level = reader->ReadInt32();
    Class = static_cast<MirClass>(reader->ReadByte());

}

void RankCharacterInfo::Save(BinaryWriter *writer)
{
    writer->Write(PlayerId);
    writer->Write(Name);
    writer->Write(level);
    writer->Write(static_cast<unsigned char>(Class));
}

QuestItemReward::QuestItemReward()
{
}

QuestItemReward::QuestItemReward(BinaryReader *reader)
{
    Item = new ItemInfo(reader);
    Count = reader->ReadUInt16();
}

void QuestItemReward::Save(BinaryWriter *writer)
{
    Item->Save(writer);
    writer->Write(Count);
}
